<template>
  <div ref="wrapper" style="height: 100%;overflow:hidden;">
    <slot></slot>
  </div>
</template>

<script>
    import BScroll from 'better-scroll'

    export default {
        props: {
            data: {
                default: null
            },
            click: {
                type: Boolean,
                default: true
            },
        },
        data(){
            return{

            }
        },
        mounted(){
            this.scroll = new BScroll(this.$refs.wrapper, {
                click: this.click,
            })
        },
        methods: {
            refresh() {
                this.scroll && this.scroll.refresh()
            },
            scrollTo() {
                this.scroll && this.scroll.scrollTo.apply(this.scroll, arguments)
            },
        },
        watch: {
            data() {
                this.refresh();
            }
        }
    }
    
</script>

<style scoped lang="scss"></style>